#include"mine.h"

void menu()
{
  printf("##---------------------##\n");
  printf("##---1. play  0.exit---##\n");
  printf("##---------------------##\n");
}

void MineInit(int (*p)[20], int row, int col)
{
  memset(p, 0, sizeof(int) * row * col);
}

void MineDisplay(int (*p)[20], int row, int col)
{
  int i = 0;
  int j = 0;
  for(i = 0; i < row; i++)
  {
    for(j = 0; j < col; j++)
    {
      if(p[i][j] == 0)
      {
        printf(". ");
      }
    }
    printf("\n");
  }
}

void Move(int play)
{
  ;
}

int IsOver(int (*p)[20], int row, int col)
{
  ;
}

void game(void)
{

   int mine[ROW][COL];
   int over = 0;
   MineInit(mine, ROW, COL);
   MineDisplay(mine, ROW, COL);
   while(1)
   {
     Move(PLAYER1);
     MineDisplay(mine, ROW, COL);
     over = IsOver(mine, ROW, COL);
     if(over != CONTINUE)
     {
       break;
     }

     Move(PLAYER2);
     MineDisplay(mine, ROW, COL);
     over = IsOver(mine, ROW, COL);
     if(over != CONTINUE)
     {
       break;
     }
   }
   if(over == PL1)
   {
     printf("player1 win!\n");
   }
   else if(over == PL2)
   {
     printf("player2 win!\n");
   }
   else
   {
     printf("draw!\n");
   }
}
